<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>lengthOfLongestSubstring</title>
</head>
<body>
<script type="text/javascript">
    var p = {
        name: '',
        sex: '',
        address: '123'
    }
    console.log(p)
    /**
     * @param {string} s
     * @return {number}
     */
    var lengthOfLongestSubstring = function (s) {
        if (s == "" || s == null) {
            return 0;
        }
        var oldstr = "";
        var maxNum = 1;
        for (let i = 0; i < s.length; i++) {
            var left = s.charAt(i);
            var newstr = left;
            for (let j = i + 1; j < s.length; j++) {
                var right = s.charAt(j);
                var isIncludes = newstr.includes(right);
                if (isIncludes) {
                    //发现重复字符串
                    oldstr = newstr;
                    newstr = "";
                    maxNum = maxNum > oldstr.length ? maxNum : oldstr.length;
                    break;
                }
                if (!isIncludes) {
                    //未发现重复字符串
                    newstr += right;
                    maxNum = maxNum > newstr.length ? maxNum : newstr.length;
                }

            }
        }
        return maxNum;
    };
</script>
</body>
</html>